package com.springboot.chongwu.controller.app;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.springboot.chongwu.entity.Baike;
import com.springboot.chongwu.entity.Zhishi;
import com.springboot.chongwu.qpage.QPage;
import com.springboot.chongwu.service.IZhishiService;
import com.springboot.chongwu.util.ResultView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-09-25
 */
@RestController
@RequestMapping("/api/front/zhishi")
public class AppZhishiController {


    @Autowired
    private IZhishiService service;


    /**
     * 获取宠物养护知识
     * @return
     */
    @GetMapping("/getSelect")
    public ResultView getSelect() {
        QueryWrapper<Zhishi> queryWrapper=new QueryWrapper<>();
        List<Zhishi> sysJydzList=this.service.list(queryWrapper);
        return ResultView.ok(sysJydzList);
    }

    /**
     * 根据ID获取当前数据
     * @return
     */
    @GetMapping("/getById")
    public ResultView getById(@NotNull(message = "ID不能为空") String id) {
        return ResultView.ok(this.service.getById(id));
    }



}
